#!/usr/bin/python
import pygtk,gtk
error_list=["Page inaccessible \n http://www.radiofg.com/modules.php?name=Fg_Titres","Pas de connection internet disponible","Planning des emissions indisponible"]

class error_window : 
    def __init__(self,error_code):
        self.error_window = gtk.Window(gtk.WINDOW_TOPLEVEL)
        self.error_window.set_title("Error")
        self.error_window.set_default_size(300, 100)
        self.error_window.connect("destroy",self.destroy)
        self.error_window.connect("delete_event",self.delete_event)
        error_lbl=gtk.Label(error_list[error_code])
        VBox=gtk.VBox(False)
        HBox=gtk.HBox(False)
        error_img = gtk.Image()
        error_img.set_from_file("Error.jpeg")
        HBox.pack_start(error_img)
        HBox.pack_start(error_lbl)
        VBox.pack_start(HBox)
        ok_butt = gtk.Button(None,gtk.STOCK_OK)
        ok_butt.connect("clicked",self.Ok_callback)
        VBox.pack_start(ok_butt)
        self.error_window.add(VBox)
        self.error_window.show_all()
#        self.main()
        
    
    def delete_event(self, widget, event=None):
       """delete_event is call when the close button is pressed"""
       return False #False call the destroy signal True don't
    
    def destroy(self, widget):
       """called by the delete_event return"""
       gtk.main_quit()
    
    def Ok_callback(self, widget):
        self.error_window.destroy()
    
    def main(self):
        gtk.main()
   

if __name__=="__main__":
    error_code=0
    error_window(error_code)